<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/style.css"/>
    <script type="text/javascript" src="__STATIC__/index/js/rem.js"></script>
    <title>订单详情</title>
</head>
<body class="geryBg">
<div class="order">
    <!--订单状态-->
    <div class="order_status clear">
        <div class="fl white status_text">
            <p>等待买家签收</p>
            <!--<p class="small-text">还剩<em>14</em>天<em>23</em>时自动确认</p>-->
        </div>
        <div class="fr status_icon">
            <img class="auto-img" src="__STATIC__/index/img/icon-order-status_3.png"/>
        </div>
    </div>
    <!--收货人地址-->
    <div class="order_address">
        <div class="order_add_detail">
            <div class="clear order_concat smoth">
                <p class="fl">收货人: <em>{$order.name}</em></p>
                <p class="fr">{$order.phone}</p>
            </div>
            <div class="order_add smoth">
                <img class="icon-add" src="__STATIC__/index/img/icon-add.png"/>
                <p>收货地址：{$order.address}</p>
            </div>
        </div>
        <p class="line"></p>
    </div>
    <!--商品详情-->
    {foreach $order.orderlist as $vo}
    <div class="order_goods clear">
        <div class="order_img fl">
            <img class="auto-img" src="{$vo.goods_spec_img}"/>
        </div>
        <div class="order_des fr">
            <div class="clear super-text smoth bold">
                <p class="fl">{$vo.goods_title}</p>
                <p class="fr">￥{$vo.price}</p>
            </div>
            <div class="clear normall-text lightgery">
                <p class="fl">{$vo.goods_spec}</p>
                <p class="fr">￥{$vo.num}</p>
            </div>
            <div class="clear normall-text lightgery">
                <p class="fr">实付：{$vo.pay}</p>
            </div>
        </div>
    </div>
    {/foreach}
    <!--运费-->
    <div class="order_carriage whiteBg">
        <div class="clear normall-text smoth">
            <p class="fl">积分</p>
            <p class="fr">-￥{$order.point_pay}</p>
        </div>
        <div class="clear super-text smoth bold">
            <p class="fl">实付款</p>
            <p class="fr brown">￥{$order.pay}</p>
        </div>
    </div>
    <!--订单支付方式-->
    <div class="order_pay smoth normall-text whiteBg">
        <p>订单编号: <em>{$order.order_num}</em></p>
        <p>支付方式: <em>微信</em></p>
        <p>下单时间: <em>{$order.create_at}</em></p>
    </div>
    <!--订单支付按钮-->
    <div class="order_btn whiteBg clear">
        <div class="fr normall-text">
            <button class="cancel" data-value="{$order.id}">查看物流</button>
            <button class="pay_now">确认收货</button>
        </div>
    </div>
</div>
<input type="hidden" name="" id="time"/>
<div class="cart_pop">
    <div class="pop_msg">
        <img class="pop_close" src="__STATIC__/index/img/icon-close.png" onclick="hideTips('.cart_pop')"/>
        <p class="text-center super-text smoth bold"></p>
        <div class="pop_btn">
            <button class="cancel" onclick="hideTips('.cart_pop')">取消</button>
            <button class="ensure">确定</button>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/index/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="__STATIC__/index/js/layer/mobile/layer.js"></script>
<script type="text/javascript">
    //弹出框
    function showTips(classname) {
        return $(classname).show()
    }

    function hideTips(classname) {
        return $(classname).hide()
    }

    //点击操作按钮
    $('.order_btn button').on('click', function () {
        if ($(this).text() == '查看物流') {
            //点击联系客服
            window.location.href = 'showwuliu?id='+$(this).data('value');
        } else if ($(this).text() == '确认收货') {
            //点击取消订单
            showTips('.cart_pop');
            $('.cart_pop .pop_msg p').html('是否确认收货?')
            //点击确定按钮
            $('.ensure').on('click', function () {
                hideTips('.cart_pop');
                $.ajax({
                    url:"sign",
                    type:"post",
                    data:{id:'{$order.id}'},
                    success:function (res) {
                        if(res.code=='ok'){
                            layer.open({
                                content: '确认收货成功',
                                skin: 'msg',
                                time: 2,
                                end: function () {
                                    window.location.reload();
                                }
                            })
                        }else{
                            layer.open({
                                content: res.msg,
                                skin: 'msg',
                                time: 2,
                                end: function () {
                                    window.location.reload();
                                }
                            })
                        }

                    }
                })

            })
        }
    })

    //倒计时时间
    $('#time').val('{$order.out_time|date="Y/m/d H:i:s"}');
</script>
</body>
</html>